<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  var arr = function (s, shifts) {
    let arr = 'abcdefghijklmnopqrstuvwxyz'.split('')
    let index = 0;
    let ans = []
    for (let i = s.length - 1; i >= 0; i--) {
      index += shifts[i]
      ans.push(arr[(s[i].charCodeAt() + index - 97) % 26])
    }
    return ans.reverse().join('');
  };
  console.log(arr(s = "abc", shifts = [3, 5, 9]));
</script>

</html>